import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const TaskTrackingMeta: ComponentMetadata = {
  componentName: 'TaskTracking',
  title: '任务追踪',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '员工管理',
  category: '数据展示',
  priority: 0,
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'TaskTracking',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '基础配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '任务追踪',
          },
          {
            name: 'englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Task Tracking',
          },
        ],
      },
      {
        title: '任务统计配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'taskStatistics',
            title: '任务统计',
            setter: {
              componentName: 'ObjectSetter',
              props: {
                config: {
                  items: [
                    {
                      name: 'totalTasks',
                      title: '任务总数',
                      setter: 'NumberSetter',
                    },
                    {
                      name: 'completedTasks',
                      title: '已完成任务',
                      setter: 'NumberSetter',
                    },
                    {
                      name: 'completionRate',
                      title: '完成率',
                      setter: 'StringSetter',
                    },
                  ],
                },
              },
            },
            defaultValue: {
              totalTasks: 278,
              completedTasks: 78,
              completionRate: '30%',
            },
          },
        ],
      },
      {
        title: '任务记录数据',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'taskRecords',
            title: '任务记录',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'key',
                          title: '唯一标识',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'eventName',
                          title: '事件名称',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'time',
                          title: '时间',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'currentStatus',
                          title: '当前状态',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'location',
                          title: '位置',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'level',
                          title: '等级',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              {
                key: '1',
                eventName: '事件1',
                time: '14:39',
                currentStatus: '未完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '2',
                eventName: '事件2',
                time: '14:39',
                currentStatus: '已完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '3',
                eventName: '事件3',
                time: '14:39',
                currentStatus: '已完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '4',
                eventName: '事件4',
                time: '14:39',
                currentStatus: '已完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '5',
                eventName: '事件5',
                time: '14:39',
                currentStatus: '未完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '6',
                eventName: '事件6',
                time: '14:39',
                currentStatus: '已完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '7',
                eventName: '事件7',
                time: '14:39',
                currentStatus: '已完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '8',
                eventName: '事件8',
                time: '14:39',
                currentStatus: '已完成',
                location: '1F大厅',
                level: '二级',
              },
              {
                key: '9',
                eventName: '事件9',
                time: '14:39',
                currentStatus: '未完成',
                location: '1F大厅',
                level: '二级',
              },
            ],
          },
        ],
      },
      {
        title: '事件处理',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'onRowClick',
            title: '行点击事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'onClick',
            title: '点击事件',
            setter: 'FunctionSetter',
          },
        ],
      },
      {
        title: '外观',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'style',
            title: '自定义样式',
            setter: 'StyleSetter',
          },
          {
            name: 'className',
            title: '自定义类名',
            setter: 'StringSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: ['onClick', 'onRowClick'],
    },
    component: {},
  },
};

const snippets: Snippet[] = [
  {
    title: '任务追踪',
    screenshot: '',
    schema: {
      componentName: 'TaskTracking',
      props: {
        title: '任务追踪',
        englishTitle: 'Task Tracking',
        taskStatistics: {
          totalTasks: 278,
          completedTasks: 78,
          completionRate: '30%',
        },
        taskRecords: [
          {
            key: '1',
            eventName: '事件1',
            time: '14:39',
            currentStatus: '未完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '2',
            eventName: '事件2',
            time: '14:39',
            currentStatus: '已完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '3',
            eventName: '事件3',
            time: '14:39',
            currentStatus: '已完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '4',
            eventName: '事件4',
            time: '14:39',
            currentStatus: '已完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '5',
            eventName: '事件5',
            time: '14:39',
            currentStatus: '未完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '6',
            eventName: '事件6',
            time: '14:39',
            currentStatus: '已完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '7',
            eventName: '事件7',
            time: '14:39',
            currentStatus: '已完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '8',
            eventName: '事件8',
            time: '14:39',
            currentStatus: '已完成',
            location: '1F大厅',
            level: '二级',
          },
          {
            key: '9',
            eventName: '事件9',
            time: '14:39',
            currentStatus: '未完成',
            location: '1F大厅',
            level: '二级',
          },
        ],
      },
    },
  },
];

export default {
  ...TaskTrackingMeta,
  snippets,
};